<!--
@license
(C) Copyright Nuxeo Corp. (http://nuxeo.com/)

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<html>
  <head>
    <title>nuxeo-slots</title>

    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes" />
    <script src="/components/@webcomponents/webcomponentsjs/webcomponents-loader.js"></script>

    <script type="module">
      import '@polymer/polymer/polymer-legacy.js';
      import '@polymer/paper-listbox/paper-listbox.js';
      import '@polymer/paper-item/paper-item.js';
      import '@polymer/paper-toggle-button/paper-toggle-button.js';
      import '@nuxeo/nuxeo-elements/nuxeo-connection.js';
      import '@nuxeo/nuxeo-elements/nuxeo-document.js';
      import '../nuxeo-demo.js';
      import '../../widgets/nuxeo-card.js';
      import '../../widgets/nuxeo-input.js';
      import '../../nuxeo-slots.js';
      import './nuxeo-alert-button.js';
    </script>
  </head>

  <body unresolved>
    <dom-bind>
      <template>
        <nuxeo-demo-section heading="Slots">
          <!-- SLOTS-->

          <nuxeo-card heading="LEFT">
            <nuxeo-slot slot="LEFT"></nuxeo-slot>
          </nuxeo-card>

          <!-- MIDDLE slot can be attached after content contributions -->
          <template is="dom-if" if="[[showMiddle]]">
            <nuxeo-card heading="MIDDLE">
              <nuxeo-slot slot="MIDDLE"></nuxeo-slot>
            </nuxeo-card>
          </template>

          <nuxeo-card heading="RIGHT">
            <nuxeo-slot slot="RIGHT"></nuxeo-slot>
          </nuxeo-card>

          <!-- Multiple LIST slots can be used. All will have the same slot content -->
          <nuxeo-card heading="LIST">
            <ul>
              <li><nuxeo-slot slot="LIST"></nuxeo-slot></li>
              <li><nuxeo-slot slot="LIST"></nuxeo-slot></li>
            </ul>
          </nuxeo-card>

          <!-- Slots can be used as children in elements that rely on child selectors since content is stamped as sibling -->
          <nuxeo-card heading="MENU">
            <paper-listbox>
              <paper-item>First item</paper-item>
              <nuxeo-slot slot="MENU"></nuxeo-slot>
            </paper-listbox>
          </nuxeo-card>

          <!-- SLOT CONTENT -->
          <nuxeo-slot-content name="one" slot="LEFT">
            <template>
              <nuxeo-alert-button message="One">ONE</nuxeo-alert-button>
            </template>
          </nuxeo-slot-content>

          <nuxeo-slot-content name="two" slot="RIGHT">
            <template>
              <nuxeo-alert-button message="Two">TWO</nuxeo-alert-button>
            </template>
          </nuxeo-slot-content>

          <nuxeo-slot-content name="item" slot="LIST">
            <template>
              <span>ITEM</span>
            </template>
          </nuxeo-slot-content>

          <nuxeo-slot-content name="yours" order="[[order]]" slot="[[category]]" disabled$="[[disabled]]">
            <template>
              <nuxeo-alert-button message="[[label]]">[[label]]</nuxeo-alert-button>
            </template>
          </nuxeo-slot-content>

          <!-- ACTIONS -->
          <table>
            <tr>
              <td>
                <nuxeo-input label="Label" value="{{label}}"></nuxeo-input>
              </td>
              <td>
                <nuxeo-input label="Category" value="{{category}}" placeholder="RIGHT, LEFT, etc..."></nuxeo-input>
              </td>
              <td>
                <nuxeo-input label="Order" value="{{order}}" type="number"></nuxeo-input>
              </td>
            </tr>
          </table>

          <paper-toggle-button checked="{{disabled}}">Disabled</paper-toggle-button>
          <paper-toggle-button checked="{{showMiddle}}">Show Middle?</paper-toggle-button>
        </nuxeo-demo-section>
      </template>
    </dom-bind>
  </body>
</html>
